
// To parse this JSON data, do
//
//     final productListModel = productListModelFromJson(jsonString);

import 'dart:convert';

ProductHostListModel productListModelFromJson(String str) => ProductHostListModel.fromJson(json.decode(str));

String productListModelToJson(ProductHostListModel data) => json.encode(data.toJson());

class ProductHostListModel {
  List<ProductHotModel> productModels;
  int total;
  int size;
  int current;
  int pages;

  ProductHostListModel({
    required this.productModels,
    required this.total,
    required this.size,
    required this.current,
    required this.pages,
  });

  ProductHostListModel copyWith({
    List<ProductHotModel>? productModels,
    int? total,
    int? size,
    int? current,
    int? pages,
  }) =>
      ProductHostListModel(
        productModels: productModels ?? this.productModels,
        total: total ?? this.total,
        size: size ?? this.size,
        current: current ?? this.current,
        pages: pages ?? this.pages,
      );

  factory ProductHostListModel.fromJson(Map<String, dynamic> json) => ProductHostListModel(
    productModels: List<ProductHotModel>.from(json["records"].map((x) => ProductHotModel.fromJson(x))),
    total: json["total"],
    size: json["size"],
    current: json["current"],
    pages: json["pages"],
  );

  Map<String, dynamic> toJson() => {
    "records": List<dynamic>.from(productModels.map((x) => x.toJson())),
    "total": total,
    "size": size,
    "current": current,
    "pages": pages,
  };
}

class ProductHotModel {
  String id;
  dynamic newFlag;
  String itemCode;
  String title;
  double price;
  String mainImage;
  String mainImageChannel;
  String channel;
  String category;
  String channelItemNo;
  double length;
  double width;
  double height;
  double weight;
  dynamic shopId;
  dynamic shopName;
  dynamic shopLog;
  dynamic shopJson;
  int showTimes;
  String imgProcess;
  int skuNumber;
  dynamic star;
  String sourceUrl;
  dynamic platformVoList;
  String? createAt;
  String? currentTime;
  String? beginTime;
  String? endTime;
  double? discountPrice;
  double? discountRate;
  String? status;
  double? litPrice;

  // "currentTime": "2025-09-13 06:11:29",
  // "beginTime": "2025-09-10 08:00:00",
  // "endTime": "2025-09-14 08:00:00",
  // "discountPrice": 13.53,
  // "discountRate": 0.4,





  ProductHotModel({
    required this.id,
    required this.newFlag,
    required this.itemCode,
    required this.title,
    required this.price,
    required this.mainImage,
    required this.mainImageChannel,
    required this.channel,
    required this.category,
    required this.channelItemNo,
    required this.length,
    required this.width,
    required this.height,
    required this.weight,
    required this.shopId,
    required this.shopName,
    required this.shopLog,
    required this.shopJson,
    required this.showTimes,
    required this.imgProcess,
    required this.skuNumber,
    required this.star,
    required this.sourceUrl,
    required this.platformVoList,
    this.createAt,
    this.currentTime,
    this.beginTime,
    this.endTime,
    this.discountPrice,
    this.discountRate,
    this.status,
    this.litPrice,



  // "discountPrice": 13.53,
  // "discountRate": 0.4,

});

  ProductHotModel copyWith({
    String? id,
    dynamic newFlag,
    String? itemCode,
    String? title,
    double? price,
    String? mainImage,
    String? mainImageChannel,
    String? channel,
    String? category,
    String? channelItemNo,
    double? length,
    double? width,
    double? height,
    double? weight,
    dynamic shopId,
    dynamic shopName,
    dynamic shopLog,
    dynamic shopJson,
    int? showTimes,
    String? imgProcess,
    int? skuNumber,
    dynamic star,
    String? sourceUrl,
    dynamic platformVoList,
    String? createAt,
    String? currentTime,
    String? beginTime,
    String? endTime,
    double? discountPrice,
    double? discountRate,
    String? status,
    double? litPrice,


  }) =>
      ProductHotModel(
        id: id ?? this.id,
        newFlag: newFlag ?? this.newFlag,
        itemCode: itemCode ?? this.itemCode,
        title: title ?? this.title,
        price: price ?? this.price,
        mainImage: mainImage ?? this.mainImage,
        mainImageChannel: mainImageChannel ?? this.mainImageChannel,
        channel: channel ?? this.channel,
        category: category ?? this.category,
        channelItemNo: channelItemNo ?? this.channelItemNo,
        length: length ?? this.length,
        width: width ?? this.width,
        height: height ?? this.height,
        weight: weight ?? this.weight,
        shopId: shopId ?? this.shopId,
        shopName: shopName ?? this.shopName,
        shopLog: shopLog ?? this.shopLog,
        shopJson: shopJson ?? this.shopJson,
        showTimes: showTimes ?? this.showTimes,
        imgProcess: imgProcess ?? this.imgProcess,
        skuNumber: skuNumber ?? this.skuNumber,
        star: star ?? this.star,
        sourceUrl: sourceUrl ?? this.sourceUrl,
        platformVoList: platformVoList ?? this.platformVoList,
        createAt: createAt ?? this.createAt,
        currentTime: currentTime ?? this.currentTime,
        beginTime: beginTime ?? this.beginTime,
        endTime: endTime ?? this.endTime,
        discountPrice: discountPrice ?? this.discountPrice,
        discountRate: discountRate ?? this.discountRate,
        status: status ?? this.status,
        litPrice: litPrice ?? this.litPrice,


      );

  factory ProductHotModel.fromJson(Map<String, dynamic> json) => ProductHotModel(
    id: "${json["id"]}"??"0",
    newFlag: json["newFlag"]??0,
    itemCode: json["itemCode"]??"",
    title: json["title"]??"",
    price: json["price"]??0.00,
    mainImage: json["mainImage"]??"",
    mainImageChannel: json["mainImageChannel"]??"",
    channel: json["channel"]??"",
    category: json["category"]??"",
    channelItemNo: json["channelItemNo"]??"",
    length: json["length"]??0.0,
    width: json["width"]??0.0,
    height: json["height"]??0.0,
    weight: json["weight"]??0.0,
    shopId: json["shopId"]??"",
    shopName: json["shopName"]??"",
    shopLog: json["shopLog"]??"",
    shopJson: json["shopJson"]??"",
    showTimes: json["showTimes"]??0,
    imgProcess: json["imgProcess"]??"",
    skuNumber: json["skuNumber"]??0,
    star: json["star"]??0,
    sourceUrl: json["sourceUrl"]??"",
    platformVoList: json["platformVoList"]??[],
    createAt: json["createAt"],
    currentTime: json["currentTime"]??"",
    beginTime: json["beginTime"]??"",
    endTime: json["endTime"]??"",
    discountPrice: json["discountPrice"]??0.0,
    discountRate: json["discountRate"]??0.0,
    status: json["status"]??"0",
    litPrice: json["litPrice"]??0.0,


  );

  Map<String, dynamic> toJson() => {
    "id": id,
    "newFlag": newFlag,
    "itemCode": itemCode,
    "title": title,
    "price": price,
    "mainImage": mainImage,
    "mainImageChannel": mainImageChannel,
    "channel": channel,
    "category": category,
    "channelItemNo": channelItemNo,
    "length": length,
    "width": width,
    "height": height,
    "weight": weight,
    "shopId": shopId,
    "shopName": shopName,
    "shopLog": shopLog,
    "shopJson": shopJson,
    "showTimes": showTimes,
    "imgProcess": imgProcess,
    "skuNumber": skuNumber,
    "star": star,
    "sourceUrl": sourceUrl,
    "platformVoList": platformVoList,
    "createAt": createAt,
    "litPrice": litPrice,
  };
}